package jeons.review.biz.impl;

import java.util.List;

import jeons.review.biz.ReviewBiz;
import jeons.review.dto.ReviewDTO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ReviewBizImpl extends SqlMapClientDaoSupport implements ReviewBiz{
	@Autowired SqlMapClientTemplate sqlMapClientTemplate;
	@Override
	
	
	public void insertData(ReviewDTO reviewDTO) {
		sqlMapClientTemplate.insert("Review.insertData", reviewDTO);
		
	}

	@Override
	public ReviewDTO getData(int reno) {
		return (ReviewDTO) sqlMapClientTemplate.queryForObject("Review.getData", reno);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<ReviewDTO> getList(ReviewDTO reviewDTO) {
		return sqlMapClientTemplate.queryForList("Review.getList",reviewDTO);
	}

	@Override
	public void updateData(ReviewDTO reviewDTO) {
		sqlMapClientTemplate.update("Review.updateData",reviewDTO);
		
	}

	@Override
	public void deleteData(int reno) {
		sqlMapClientTemplate.delete("Review.deleteData", reno);
	}

	@Override
	public int getCount() {
		return (int) sqlMapClientTemplate.queryForObject("Review.getCount");
	}

	@Override
	public String getUserPasswd(int reno) {
		return (String) sqlMapClientTemplate.queryForObject("Review.getUserPasswd", reno);
	}

}
